<div>
	<div class="left">
  		<?php require_once 'filter.php';?>
	</div>
	<div id="central-content-questions" class="left">
		<div id="question_banner"><?php echo lang('questions_banner',true);?></div>
		
		<div style="width:525px;float:left;">
			<div class="head rposition"> <h4><?php echo lang('latest_questions');?></h4></div>
			<div id="questions-container">
				<?php if (count($questions)){?>
					<div id="question-list" class="container">
					
					<div class="content">
							<?php 
								$count_questions = 0;
								foreach($questions as $key=>$question){
									$count_questions++;
								?>
							
								<div class='question-item'>
									<div class='question-head'><?php echo lang('asked_by')?> <?php echo (strlen($question->user_name) ? $question->user_name : lang('anonimus'))?></div>
									<div class='question-text'>
										<?php echo $question->question?>									
										<br />								
									</div>
									<?php if ($question->answered_by){?>
										<div class='question-head'><?php echo lang('answered_by')?>&nbsp;<?php echo (isset($question->answered_by_user) ? $question->answered_by_user : lang('anonimus'))?></div>
										<div class='question-text'><?php echo $question->answer?></div>
									<?php }?>
									<div>
										<div class="left grey">
											<?php echo date('d/m/Y',strtotime($question->data))?> <?php echo lang('views_label')?> <?php echo $question->views?>
										</div>
										<div class="right">
											<?php if ($question->answered_by){?>
												<span class="answered"><img src="<?php echo IMAGES_URL . 'icons/green_check.png'?>" /><?php echo lang('answered_text')?></span>
												<?php 
												if($count_questions == 1){?>
													<span class="ask-question-button" onClick="askQuestion()"><?php echo lang('ask_a_question')?></span>
												<?php }?>
												<span class="read-more-button" onClick="showQuestion(<?php echo $question->id?>)"><?php echo lang('read_more_text')?><img src="<?php echo IMAGES_URL . 'icons/read_more_icon.png'?>" /></span>
											<?php }?>
										</div>
										<div class="clear"></div>
									</div>
								</div>
							
							<?php }?>
					</div>
					
					<div class="page_navigation"></div>
						
					</div>
				<?php } else {?>
					<div style="height: 30px;padding-top:15px;">
						<?php echo lang('no_questions_message');?>
						<span class="ask-question-button" onClick="askQuestion()"><?php echo lang('ask_a_question')?></span>
					</div>
				<?php }?>
			</div>
		</div>
		<div class="left">
			<div id="search_question_container">
				<div id="search_question">
					<?php echo lang('search_answered_question')?>
				</div>
				<div>
					<input type="text" name="search_question_field" id="search_question_field" value="<?php echo (isset($keyword) ? $keyword : '');?>" /><span id="search-button"><?php echo lang('search');?></span>
				</div>
			</div>
			
			<?php if (isset($experts) && !empty($experts)){?>
				<div id="our_experts">
					<div class="head rposition"> <h4><?php echo lang('our_experts');?></h4></div>
				</div>
				<div id="experts_content">
					<?php foreach ($experts as $expert){?>
						<div class="expert-separator">
							<div class="expert-image">
								<?php 
								if(file_exists(IMAGES_PATH . 'user_pics/' . $expert->profile_pic)){
									echo "<img src='" . IMAGES_URL . "user_pics/" . $expert->profile_pic . "' style='width:60px;height:70px;' />";
								} else {
									echo "&nbsp;";
								}
								?>
							</div>
							<div class="expert-content">
								<div class="expert-name">
									<?php echo (strlen($expert->user_name) ? $expert->user_name : lang('anonimus'));?>
								</div>
								<?php if (strlen($expert->description)){?>
									<div>
										<span>
											<strong><?php echo lang('favourite_piece')?>:</strong>
										</span><br />
										<span>
											<?php echo $expert->description;?>
										</span>
									</div>
								<?php }?>
							</div>
							<div class="clear"></div>
						</div>
					<?php }?>
				</div>
			<?php }?>
		</div>
	</div>
	<div class="clear"></div>
</div>

<div id="question-details-modal"></div>
<form id="ask_the_jeweler">
	<div id="question-container">
			
		<label><?php echo lang("question_for_jeweler")?>:</label>
		<textarea name="question" id="question" style="width:370px;height: 80px;" class="required"></textarea>
	</div>
	<div id="question-status-success" class="message ui-state-highlight"><?php echo lang('question_success')?></div>
	<div id="question-status-error" class="message ui-state-error"><?php echo lang('question_error')?></div>
</form>
